package com.imooc.spring.aop.service;

import com.imooc.spring.aop.dao.UserDao;

public class UserService {
    private UserDao userDao;

    public void createUser() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        /*if (1==1){
            throw new RuntimeException("模拟异常");
        }*/
        System.out.println("执行用户注册业务逻辑");
        userDao.insert();
    }

    public String generateRandomPassword(String type, Integer length) {
        System.out.println("按" + type + "方式升成" + length + "位随机密码");
        return "Zxcquei1";
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
